<?php

namespace module\app\controller;

use app\Controller;
use app\model\User as Model;
use app\model\Activity;
use app\model\UserAddress;
use app\model\Coupon;
use app\model\City;

class User extends Controller
{
    /**
     * 列表.
     * 
     */
    public function index()
    {
        $result = Model::withSearch(['mobile', 'name'], input('get.'))->paginate([
            'list_rows'=> input('get.pageSize/d', 10),
        ]);
        return json([
            'items' => $result->items(),
            'total' => $result->total()
        ]);
    }
    /**
     * 详情.
     * 
     * @param int $id
     */
    public function read(int $id = 0)
    {
        $model = Model::findOrFail($id ?: request()->uid);
        return json($model->toArray());
    }
}


